Skip to main content

All Questions

Tagged with
0votes
1answer
52views

Aggregate transactions in slips

I wrote code to aggregate transactions in slips. I'm concerned with the performance of my code because it uses 3 loops that are nested so the time complexity will be cubic. This code won't scale well ...
bit's user avatar
  • 143
0votes
1answer
85views

Parsing shortcodes out of a string

I wrote this shortcode parsing and it runs in \$O(N^2)\$. Is there a way to better optimize this? ...
ericraio's user avatar
2votes
2answers
746views

Golang implementation of dining philosophers variant

I would like to implement a variant of the classical dining philosophers problem which has the definition as: Implement the dining philosopher’s problem with the following constraints/modifications. ...
Vincent Wen's user avatar
4votes
1answer
340views

Golang function that reads S3 files and populates maps with strings as keys

I have a below read function which is called by multiple go routines to read s3 files and it populates two concurrent map as ...
AndyP's user avatar
2votes
1answer
158views

Golang solution to CTCI 1.2: Check whether two strings are permutations of each other

Just started learning Go recently. Did some questions from Cracking the Coding Interview book. Wrote the solutions in Go. Let me know what you think. https://github.com/samjingwen/ctci Below is ...
Sam Jing Wen's user avatar
0votes
1answer
107views

Is there a better "Go" way to implement LC Add Two Numbers solution

Problem Statement: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the ...
Em Ae's user avatar
0votes
1answer
108views

How to make Print() method memory & CPU efficient?

Problem Statement You are receiving n objects in a random order, and you need to print them to stdout correctly ordered by sequence number. The sequence numbers start from 0 (zero) and you have to ...
overexchange's user avatar
2votes
1answer
169views

Blocking send and receive algorithm in Go

I'm sending and receiving data over an interface (serial in this case) with the following behaviour: The receiver sends back an Ack message if a message is delivered successfully. If an Ack is not ...
backyard_gamer's user avatar
4votes
1answer
171views

CLRS implementation (opportunity to sort subarray) of merge sort in golang

I'm reading "Introduction to Algorithms" by CLRS and I can't find an implementation of the pseudo code from the book in golang. By the original implementation I mean that we deal with extra parameters ...
maxim-glyzin's user avatar
2votes
0answers
43views

How to define UDP connection sessions more correctly?

Listening to messages from the udp socket, I would like to somehow determine where packets come from and scatter in sessions to get a more detailed report on the received data, I just did it forehead, ...
JohnnyCage's user avatar
2votes
2answers
84views

Count the number of discrete values in a slice

I'm using this right now to count the number of discrete values in a given []string. Is there a faster way to do this? ...
Nathan F.'s user avatar
4votes
1answer
2kviews

Matrix Transpose in Golang

I have write a normal programm "Transpose the matrix" in go. Suppose input are always correct. I also read the article An Efficient Matrix Transpose in CUDA C/C++. So I keen to know how I can use Go-...
Manjeet Singh's user avatar
7votes
1answer
294views

Boyer Moore Horspool Search Algorithm in Go

I am practicing Go and try to implement Boyer Moore Horspool Algorithm in Go, It returns all ocurrance of a "phrase" in a given text. This code is working, but I would be pleased to have any feedback ...
Mazdak's user avatar
5votes
1answer
178views

Find the longest word in a string

I have written code in the language Go. I wonder if anyone can do it in a very simple and effective way, because every language has its own way to solve this problem. My experience is in JavaScript. ...
Mannu's user avatar
2votes
3answers
2kviews

Remove adjacent duplicates in golang

This is an exercise in a book which ask me to implement Write an in-place function to eliminate adjacent duplicates in a []string slice. I am relatively new to golang and I am not sure if my ...
user200771's user avatar

153050per page
close